<template>
  <div class="root">
    <p></p>
    <pre>
      <code>
        const ua = navigator.userAgent.toLowerCase();
        // console.log(ua)
        export default {
          mobile: () => {
            return 'ontouchstart' in window || ua.indexOf('touch') > -1 || ua.indexOf('mobile') > -1
          },
          safari: () => {
            return ua.indexOf('safari') > -1 && !window.chrome
          },
          app: () => {
            return ua.indexOf('yyzhuanapp') > -1
          },
          ie: () => {
            return !!window.ActiveXObject || 'ActiveXObject' in window
          },
          
          ios: () => {
            return !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/i)
          },
          ios_ver: () => {
            return ua.match(/cpu iphone os (.*?) like mac os/);
            // Number(browser.ios_ver()[1].replace('_','.')) 转成常见的数字版本号
          },
          android: () => {
            return ua.indexOf('android') > -1 || ua.indexOf('adr') > -1
          },
          android_ver: () => {
            return ua.match(/android (.*?);/);
          },
          wechat: () => {
            return ua.indexOf('micromessenger') > -1
          },
          
          pcWechart: () => {
            return ua.indexOf('windowswechat') > -1
          },
          
          qq: () => {
            return ua.match(/\sQQ/i) == 'qq'
          },
          
          weibo: () => {
            return ua.indexOf('weibo') > -1
          },
          
          iphone: () => {
            return ua.indexOf('iphone') > -1
          },
          
          ipad: () => {
            return ua.indexOf('ipad') > -1
          }
        }
      </code>
    </pre>
  </div>
</template>

<script>
  export default {
    components: {},

    data() {
      return {
        
      };
    },

    created() {},

    mounted() {},

    methods: {
      
    }
  };
</script>
<style lang="less" scoped>
  
</style>
